﻿using Microsoft.Extensions.Logging;
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging.Console;

namespace DemoConsoleLog
{
    class Program
    {
        static void Main(string[] args)
        {
            var configurationBuilder = new ConfigurationBuilder();
            configurationBuilder.AddJsonFile("appsettings.json");
            var configuration = configurationBuilder.Build();

            var f2 = new LoggerFactory();
            

            var factory = LoggerFactory.Create(b =>
                b
                    //.SetMinimumLevel(LogLevel.Information)
                    .AddConfiguration(configuration)
                    .AddConsole(options =>
                    {

                    })
                    .AddDebug()
            //.AddFilter("Program", LogLevel.Information)
            ) ;


            //var logger = factory.CreateLogger<Program>();
            //logger.LogInformation("Info");
            //logger.LogWarning("Warning");
            //logger.LogDebug("Debug");
            //logger.LogError("Error");

            var logger = factory.CreateLogger<Program>();
            if(logger.IsEnabled(LogLevel.Debug)){
                Console.WriteLine("Debug Enabled");

            }
            logger.LogDebug("Program Debug");
            logger.LogInformation("Program Information");


            factory.Dispose();




            //Console.WriteLine("Hello World!");
        }
    }
}
